package com.dubbo.consomer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dubbo.consomer.freamwork.RestfulResult;
import com.dubbo.remote.OrgFacade;
import com.dubbo.remote.common.PageInfo;
import com.dubbo.remote.request.OrgQueryReq;

@RestController
public class OrgWeb {
	@Autowired
	private OrgFacade orgFacade;

	@GetMapping("/pageList")
	public RestfulResult pageList(String kinCode,Integer page, Integer limit) {
		OrgQueryReq orgQueryReq =new OrgQueryReq();
		orgQueryReq.setKinCode(kinCode);
		if(page!=null && limit!=null){
			PageInfo pageInfo = new PageInfo();
			pageInfo.setCurrentPage(page);
			pageInfo.setPageSize(limit);
			orgQueryReq.setPageInfo(pageInfo);
		}
		return RestfulResult.succeed(orgFacade.list(orgQueryReq));
	}
}
